package com.example.permission.controller;

import com.example.permission.annotation.ApiPermission;
import com.example.permission.enums.PermissionType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @ApiPermission(name = "用户查询", permissions = {PermissionType.READ})
    @GetMapping("/list")
    public String listUsers() {
        return "用户列表";
    }

    @ApiPermission(name = "新增用户", permissions = {PermissionType.WRITE})
    @PostMapping("/add")
    public String addUser() {
        return "添加成功";
    }
}
